package com.woniu.liuzhougov.relatedinformation.service.impl;

import com.woniu.liuzhougov.relatedinformation.dao.CommerceMapper;
import com.woniu.liuzhougov.relatedinformation.pojo.Commerce;
import com.woniu.liuzhougov.relatedinformation.service.RelatedInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: desc
 * @author: Chris
 * @createDate: 2019/4/24 0024
 * @version: 1.0
 */
@Service("commerceService")
public class CommerceServiceImpl implements RelatedInformationService<Commerce> {

    @Autowired
    private CommerceMapper commerceMapper;

    @Override
    public List<Commerce> selectList() {
        return commerceMapper.selectList();
    }

    @Override
    public List<Commerce>  selectByName(String name) {
        return commerceMapper.selectByName(name);
    }

    @Override
    @Transactional
    public int deleteById(Integer id) {
        return commerceMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Commerce selectById(Integer id) {
        return commerceMapper.selectByPrimaryKey(id);
    }

    @Override
    @Transactional
    public int insert(Commerce commerce) {
        return commerceMapper.insert(commerce);
    }

    @Override
    @Transactional
    public int update(Commerce commerce) {
        return commerceMapper.updateByPrimaryKey(commerce);
    }
}
